#include<iostream>
int main() 
{
	int v[256];
	int pi,i=0,j,cat,rest,b;
	double nr;
	std::cout<<"Introduceti numarul in baza 10:\n";
	std::cin>>nr;
	std::cout<<"Dati baza in care sa se converteasca (2>=b<=9): \n";
	std::cin>>b;
	pi=nr;
	for(j=0;j<256;++j)
	{
		v[j]=0;
	}
	for(j=0;j<10;++j)
	{
		v[j]=0;
	}
	std::cout<<"Nr intreg -> "<<nr<<"\n";
	std::cout<<"Nr in baza "<<b<<" -> ";
	while(pi!=0)
	{
		cat=pi/b;
		rest=pi%b;
		v[i++]=rest;
		pi=cat;
	}
	if(i>1)
	{
		for(j=i-1;j>-1;j--)
		{
			if(v[j]<9)
				std::cout<<v[j];
		}
	}
	else
	{
		std::cout<<0;
	}
	std::cout<<"\n";
	return 0;
}
